package main

import "fmt"

type Person struct {
	name string
	age  int
}

type Runner interface {
	run() //只有声明，没有实现，具体实现看具体的类型

}

type Jumper interface {
	jump()
}

type Sporter interface {
	Runner // 嵌套
	Jumper
}

func (*Person) run() {
	fmt.Println("Run~~~~~")
}

func (*Person) jump() {
	fmt.Println("Jump~~~~~")
}

func main() {
	a := new(Person) // Person实现该接口，因为它实现了该接口所有方法
	a.run()
	a.jump()
	// a 既是 Person 的实例，又是 Sporter接口的，又是 Runner 类型的，又是Jumper 类型的
	fmt.Println("~~~~~~~~~~~~~~~~~~~~~~~~~~~")
	var r Runner
	r = a
	r.run()
	fmt.Println("~~~~~~~~~~~~~~~~~~~~~~~~~~~")

	var j Jumper
	j = a
	j.jump()
	fmt.Println("~~~~~~~~~~~~~~~~~~~~~~~~~~~")

	var s Sporter
	s = a
	s.jump()
	s.run()
}
